<?php

namespace app\common;

use \app\common\enum\Cache as CacheEnum;

class Cache
{
    private static array $map = [];

    public static function set(CacheEnum $k, $v): void
    {
        self::$map[$k->name] = $v;
    }

    public static function get(CacheEnum $k = null)
    {
        if (!empty($k)) {
            return self::$map[$k->name] ?? '';
        }

        return self::$map;
    }

    public static function clear(): void
    {
        self::$map = [];
    }
}